<template>
  <div style="height: 600px">
    <el-collapse accordion>
      <el-main >
        <div style="margin: 20px 0; text-align: center; font-size: 24px">
          <h2>系统公告</h2>
        </div>
        <el-collapse accordion v-model="active">
          <el-collapse-item :name="index" v-for="(item ,index) in notices" :key="item.id">
            <template slot="title">
              <b>{{"公告"}}</b>
              <b>{{item.id}}</b>
              <b>{{"："}}</b>
              <b>{{ item.title }}</b>
              <span style="margin-left: 50px; color: #888">{{ item.time }}</span>
            </template>
            <div style="padding: 0 20px">{{ item.content }}</div>
          </el-collapse-item>
        </el-collapse>
      </el-main>
    </el-collapse>
  </div>
</template>

<script>
import {IP} from "@/config";
import axios from "axios";

export default {
  data(){
    return{
      notices: [
      ],
      active: 0,

    }
  },
  mounted() {
    let url = IP + "notice/getAll"
    axios.post(url).then(res=>{
      console.log(res)
      this.notices = res.data.data.noticeList
    }).catch(error=>{
      console.log(error)
    })
  }
}

</script>

<style scoped>

</style>